import React from "react";
import styles from "./index.less";
import {connect} from 'dva';
import {
  LoadingOutlined,
} from '@ant-design/icons';

class GongyiParam extends React.Component {

  componentDidMount() {
    const {dispatch} = this.props;
    dispatch({
      type: 'fengxiang/getLatestParam',
    })
  }

  getValue = key => {
    const {latestParam} = this.props;
    if (latestParam) {
      const value = latestParam[key];
      if (value === undefined || value === null) return '暂无数据';
      return value.toFixed(2)
    }
    return '暂无数据'
  }

  render() {


    const a = {
      'CG_SJ_SJJ_SJ02_MQZGYL': '煤气支管压力',
      'CG_SJ_SJJ_SJ02_MQZGLL': '煤气支管流量',
      'CG_SJ_SJJ_SJ02_KQGDYL': '空气支管压力',
      'CG_SJ_SJJ_SJ02_ZRFWD': '空气支管温度',
      'CG_SJ_SJJ_SJ02_ZRFLL': '空气支管流量',
      'CG_SJ_SJJ_SJ02_FJFL01': '',
      'CG_SJ_SJJ_SJ02_FJFL02': '',
      'CG_SJ_SJJ_SJ02_FMKD01': '风门开度01',
      'CG_SJ_SJJ_SJ02_FMKD02': '风门开度02',
      'CG_SJ_SJJ_SJ02_LQSJKYL': '冷却水进口压力',
      'CG_SJ_SJJ_SJ02_LQSCKYL': '冷却水出口压力',
      'CG_SJ_SJJ_SJ02_LQSCKLL': '冷却水出口流量',
      'CG_SJ_SJJ_SJ02_LQSCKWD': '冷却水出口温度',
      'CG_SJ_SJJ_SJ02_BSXSD': '给矿机机速',
      'CG_SJ_SJJ_SJ02_HLJXS': '环冷机机速',
      'CG_SJ_SJJ_SJ02_HLCKWD': '环冷机温度'


    }
    return (
      <table className={styles.descItems}>
        <tbody>
        <tr>
          <th className={styles.descItemsLabel} colSpan={2}>煤气支管</th>
          <th className={styles.descItemsLabel} colSpan={3}>空气支管</th>
          <th className={styles.descItemsLabel} rowSpan={2}>风机风量1(m³/h)</th>
          <th className={styles.descItemsLabel} rowSpan={2}>风机风量2(m³/h)</th>
          <th className={styles.descItemsLabel} rowSpan={2}>风门开度1(％)</th>
          <th className={styles.descItemsLabel} rowSpan={2}>风门开度2(％)</th>
        </tr>
        <tr>
          <th className={styles.descItemsLabel}>压力(kPa)</th>
          <th className={styles.descItemsLabel}>流量(m³/h)</th>
          <th className={styles.descItemsLabel}>压力(kPa)</th>
          <th className={styles.descItemsLabel}>温度(℃)</th>
          <th className={styles.descItemsLabel}>流量(m³/h)</th>
        </tr>
        <tr>
          <td>{this.getValue("CG_SJ_SJJ_SJ02_MQZGYL")}</td>
          <td>{this.getValue("CG_SJ_SJJ_SJ02_MQZGLL")}</td>
          <td>{this.getValue("CG_SJ_SJJ_SJ02_KQGDYL")}</td>
          <td>{this.getValue("CG_SJ_SJJ_SJ02_ZRFWD")}</td>
          <td>{this.getValue("CG_SJ_SJJ_SJ02_ZRFLL")}</td>
          <td>{this.getValue("CG_SJ_SJJ_SJ02_FJFL01")}</td>
          <td>{this.getValue("CG_SJ_SJJ_SJ02_FJFL02")}</td>
          <td>{this.getValue("CG_SJ_SJJ_SJ02_FMKD01")}</td>
          <td>{this.getValue("CG_SJ_SJJ_SJ02_FMKD02")}</td>
        </tr>

        <tr>
          <th className={styles.descItemsLabel} colSpan={6}>单辊破碎机</th>
          <th className={styles.descItemsLabel} rowSpan={2}>给矿机(m/min)</th>
          <th className={styles.descItemsLabel} colSpan={2}>环冷机</th>
        </tr>

        <tr>
          <th className={styles.descItemsLabel} colSpan={2}>冷却水进口压力(kPa)</th>
          <th className={styles.descItemsLabel} colSpan={1}>冷却水出口压力(kPa)</th>
          <th className={styles.descItemsLabel} colSpan={1}>冷却水出口流量(m³/h)</th>
          <th className={styles.descItemsLabel} colSpan={2}>冷却水出口温度(℃)</th>
          <th className={styles.descItemsLabel}>机速(m/min)</th>
          <th className={styles.descItemsLabel}>出口温度(℃)</th>
        </tr>

        <tr>
          <td colSpan={2}>{this.getValue("CG_SJ_SJJ_SJ02_LQSJKYL")}</td>
          <td>{this.getValue("CG_SJ_SJJ_SJ02_LQSCKYL")}</td>
          <td>{this.getValue("CG_SJ_SJJ_SJ02_LQSCKLL")}</td>
          <td colSpan={2}>{this.getValue("CG_SJ_SJJ_SJ02_LQSCKWD")}</td>
          <td>{this.getValue("CG_SJ_SJJ_SJ02_BSXSD")}</td>
          <td>{this.getValue("CG_SJ_SJJ_SJ02_HLJXS")}</td>
          <td>{this.getValue("CG_SJ_SJJ_SJ02_HLCKWD")}</td>
        </tr>

        </tbody>
      </table>
    )
  }
}

export default connect(({fengxiang, loading, global}) => ({
  latestParam: fengxiang.latestParam
}))
(GongyiParam);

